export default {
    update(el, binding) {
        if(binding.value != 0) {
            let timer = null;
            const targetDomCount = binding.value
            const digit = targetDomCount.toString().split('.')[1].length
            // 数字动画总是分25次走完 （可自行更改）
            let step=targetDomCount/25
            let nowCount = el.innerHTML; //当前页面显示值
            timer = setInterval(() => {
                if (parseFloat(nowCount).toFixed(digit) < targetDomCount) {
                    nowCount = parseFloat(nowCount) + parseFloat(step)
                } else {
                    clearInterval(timer)
                    timer = null;
                }
                el.innerHTML = parseFloat(nowCount).toFixed(digit)
            }, 50)
        }
    },
}

